﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Spaanjaars.ContactManager.Infrastructure.Domain;
using Spaanjaars.ContactManager.Infrastructure.Validation;

namespace Spaanjaars.ContactManager.Model
{
    public class ContactPersonAddress : Entity<int, ContactPersonAddress>
    {
        private ContactPersonAddress()
        {
                
        }

        public ContactPersonAddress(Address address, ContactPerson contactPerson)
        {
            Check.ThrowExceptionIfAnyBrokenRules(address, "Changing Address");
            Check.ThrowExceptionIf(contactPerson == null, "");

            Address = address;            
            ContactPerson = contactPerson;
        }

        public Address Address { get; private set; }  

        public void ChangeAddressTo(Address address)
        {
            Check.ThrowExceptionIfAnyBrokenRules(address, "Changing Address");

            Address = address;
        }

        public ContactPerson ContactPerson { get; private set; }

        public override IEnumerable<IBrokenRule> GetBrokenRulesFor(IDomainObjectValidator<ContactPersonAddress> domainObjectValidator)
        {
            throw new NotImplementedException();
        }

        public override IEnumerable<IBrokenRule> GetBrokenRules()
        {
            throw new NotImplementedException();
        }
    }
}
